<template>
  <!-- 个人信息 -->
  <page-loading :show="showPage">
    <view>
      <view class="container" v-if="selectLog">
        <u-toast ref="uToast" />
        <view class="headcsss">
          <view class="name font-28 color-333">
            个人信息
          </view>
          <view class="headimg" @click="uploadImage">
            <view class="headbox flex flex-jc-sb flex-ai-c">
              <view class="font-24 color-999">
                头像
              </view>
              <view class="flex flex-ai-c flex-jc-c">
                <view class="images mr-20">
                  <image :src="perList.headportrait" mode="aspectFill"></image>
                </view>
                <view>
                  <u-icon name="arrow-right" color="#9A9A9A" size="24rpx"></u-icon>
                </view>
              </view>
            </view>
          </view>
          <view class="headimg">
            <view class="headbox1 flex flex-jc-sb flex-ai-c mt-20">
              <view class="font-24 color-999">
                昵称
              </view>
              <view class="flex flex-ai-c flex-jc-c">
                <view class="images mr-20">
                  <input class="inputname" v-model="perList.nickname" maxlength="8" /><!-- :value="perList.nickname" -->
                </view>
                <view>
                  <i-icon icon="iconxiugai" type="single" size="32rpx" color="#999999"></i-icon>
                </view>
              </view>
            </view>
          </view>
          <view class="headimg" @tap="sexpopup = true">
            <view class="headbox1 flex flex-jc-sb flex-ai-c mt-20">
              <view class="font-24 color-999">
                性别
              </view>
              <view class="flex flex-ai-c flex-jc-c">
                <view class="images mr-20">
                  <text v-if="perList.sex === 0">未设置</text>
                  <text v-else-if="perList.sex === 1">男</text>
                  <text v-else="perList.sex === 2">女</text>
                </view>
                <view>
                  <u-icon name="arrow-right" color="#9A9A9A" size="24rpx"></u-icon>
                </view>
              </view>
            </view>
          </view>
          <view class="headimg" @tap="timeshow = true">
            <view class="bthbox flex flex-jc-sb flex-ai-c mt-20">
              <view class="font-24 color-999">
                生日
              </view>
              <view class="flex flex-ai-c flex-jc-c">
                <view class="images mr-20">
                  {{perList.birthday}}
                </view>
                <view>
                  <u-icon name="arrow-right" color="#9A9A9A" size="24rpx"></u-icon>
                </view>
              </view>
            </view>
          </view>
        </view>
        <view class="renze mt-15">
          <view class="headimgs">
            <view class="bthboxs flex flex-jc-sb flex-ai-c">
              <view class="font-24 color-999">
                实名认证
              </view>
              <view class="flex flex-ai-c flex-jc-c" @click="arrroveClick(perList.approve)">
                <view class="imagess mr-20">
                  <text v-if="perList.approve">已认证</text>
                  <text v-else>未认证</text>
                </view>
                <view>
                  <u-icon name="arrow-right" color="#9A9A9A" size="24rpx"></u-icon>
                </view>
              </view>
            </view>
          </view>
        </view>
        <view class="renze mt-15" @click="addressClick">
          <view class="headimgs">
            <view class="bthboxs flex flex-jc-sb flex-ai-c font-24 color-999">
              <view class="">
                收货地址
              </view>
              <view class="flex flex-ai-c flex-jc-c">
                <view class="mr-20" v-if="perList.address_number === 0">
                  暂无收货地址
                </view>
                <view class="mr-20" v-else>
                  {{perList.address_number}}条收货地址
                </view>
                <view>
                  <u-icon name="arrow-right" color="#9A9A9A" size="24rpx"></u-icon>
                </view>
              </view>
            </view>
          </view>
        </view>
        <view class="preservation" @click="preserClick">
          保存
        </view>
        <view class="myQRCode">
          <view class="name font-28 color-333">
            我的二维码
          </view>
          <view class="codeimg flex flex-jc-c">
            <image src="https://files.yzsheng.com/client/commodity/erweima@2x.png" mode="aspectFill"></image>
            <view class="codename" @click="copyCode(perList.invitecode)">
              <text class="mr-15">{{perList.invitecode}}</text>
              <i-icon icon="iconfuzhi" type="single" size="37rpx" color="#999999"></i-icon>
            </view>
            <view class="codeimgs">
              <image :src="perList.app_QR_code" mode="aspectFill"></image>
            </view>
          </view>
          <view class="tishi font-26 color-666">
            好友注册后你将获得39元全城免费洗车券&1000元 购车券好友也将领取到同等价值优惠券
          </view>
          <view class="share flex flex-jc-c">
            <!-- #ifndef MP-WEIXIN -->
            <view class="sharebox" @click="goPartner('WXSceneSession')">
              <i-icon icon="iconweixin" type="single" size="70rpx" color="#46bb36"></i-icon>
              <view class="sharename font-26 color-333 mt-10">
                微信
              </view>
            </view>
            <view class="sharebox" @click="goPartner('WXSenceTimeline')">
              <i-icon icon="iconpengyouquan" type="multiple" size="70rpx"></i-icon>
              <view class="sharename font-26 color-333 mt-10">
                朋友圈
              </view>
            </view>
            <!-- #endif -->
            <!-- #ifdef MP-WEIXIN -->
            <label class="sharebox">
              <i-icon icon="iconweixin" type="single" size="70rpx" color="#46bb36"></i-icon>
              <view class="sharename font-26 color-333 mt-10">
                微信
              </view>
              <button open-type="share"></button>
            </label>
            <!-- #endif -->
            <view class="sharebox" @click="saveImgLocal(perList.app_QR_code)">
              <i-icon icon="iconbaocunbendi" type="single" size="70rpx" color="#47A2FF"></i-icon>
              <view class="sharename font-26 color-333 mt-10">
                保存到本地
              </view>
            </view>
          </view>
        </view>

        <!-- 选择性别-->
        <u-popup v-model="sexpopup" mode="bottom" border-radius="30">
          <view class="hgzbox" style="height: 300rpx;">
            <view class="gejucss" @click="sexclicks(item)" v-for="(item,index) in sexlist" :key="index">
              {{item.name}}
            </view>
            <view class="quxiao" @tap="sexpopup = false">
              取消
            </view>
          </view>
        </u-popup>
        <!-- 选择日期 -->
        <u-picker v-model="timeshow" mode="time" confirm-color="#FBB000" @confirm="timeclick"></u-picker>

        <!-- 温馨提示 -->
        <view class="uni-popup" v-if="success">
          <view class="main">
            <view class="heades">
              温馨提示
            </view>
            <view class="jiangchuli">
              您修改的内容还未进行保存
            </view>
            <view class="popup-footer flex">
              <view class="disagreeBtn" @tap="shenclick(0)">取消</view>
              <view class="fanhuishouy" @tap="shenclick(1)">保存</view>
            </view>
          </view>
        </view>
      </view>

      <view class="" v-show="!selectLog">
        <kps-image-cutter @ok="onok" @cancel="oncancle" :url="logoImg" :fixed="true" :width="100" :height="100"></kps-image-cutter>
      </view>
    </view>
  </page-loading>
</template>

<script src="./personalInformation.js"></script>
<style src="./personalInformation.scss" lang="scss" scoped></style>
